package com.itheima.mm.service.impl;

import com.itheima.framework.annotation.HmComponent;
import com.itheima.mm.dao.UserDao;
import com.itheima.mm.database.SqlSessionUtils;
import com.itheima.mm.pojo.User;
import com.itheima.mm.service.UserService;
import org.apache.ibatis.session.SqlSession;

/**
 * @author ：wanghao
 * @date ：Created in 2020/10/18
 * @description ：
 * @version: 1.0
 */
@HmComponent("userService")
public class UserServiceImpl implements UserService {
    @Override
    public User findUserByUsername(String username) {
        SqlSession sqlSession = SqlSessionUtils.openSession();
        UserDao mapper = sqlSession.getMapper(UserDao.class);
        User user = mapper.selectUserByUsername(username);
        return user;
    }
}
